package org.jeecg.enums;

/**
 * 支付渠道
 */
public enum PayChannelEnum {
    PAY_CHANNEL_CEB("CEB", "光大"),
    PAY_CHANNEL_FFT("FFT", "付费通"),
    PAY_CHANNEL_NP("NP","直连"),
    PAY_CHANNEL_SH("SH","公共平台"),
    PAY_CHANNEL_OFFLINE("offline","线下"),
    ;

    private String code;
    private String desc;

    PayChannelEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


    public static String getDesc(String value) {
        if (value == null) return "";
        PayChannelEnum[] enums = values();
        for (PayChannelEnum typeEnum : enums) {
            if (value.equals( typeEnum.getCode())) {
                return typeEnum.desc;
            }
        }
        return "";
    }

    public static String getValue(String desc) {
        PayChannelEnum[] enums = values();
        for (PayChannelEnum typeEnum : enums) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.code;
            }
        }
        return null;
    }
}
